home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Just Call Me Internet
/
Just Call Me Internet.iso
/
prog
/
atari
/
m2
/
cat3src
/
cat
/
catbutto.i
< prev
next >
Wrap
Text File
|
1997-10-26
|
7KB
|
244 lines
IMPLEMENTATION MODULE CatButtons;
FROM SYSTEM IMPORT ADDRESS, ADR, CALLSYS, CADR;
FROM UserInformation IMPORT UserBLK;
FROM Void IMPORT v;
IMPORT MagicAES;
IMPORT MausTauschrsc;
IMPORT MTE;
IMPORT mtAppl;
IMPORT mtAlerts;
IMPORT mtUtils;
IMPORT WdwManager;
IMPORT CatGlobal;
IMPORT ConfVars;
IMPORT Varnames;
IMPORT MTPaths;
IMPORT mtDir;
IMPORT GrafBase;
CONST elements = {MagicAES.NAME, MagicAES.CLOSER, MagicAES.MOVE};
VAR (*WinHandle : INTEGER;*)
j,t : INTEGER;
ButtonWin : ADDRESS;
objPtr : POINTER TO ARRAY[0..200] OF MagicAES.OBJECT;
name : ARRAY[0..20] OF CHAR;
wdwTopped : BOOLEAN;
isHidden : BOOLEAN;
globalExit: BOOLEAN;
PROCEDURE clickInButton (wdw, vdi : INTEGER; env : ADDRESS; mx, my : INTEGER; kstate, buts : BITSET; clicks :INTEGER): BOOLEAN;
BEGIN
(* Hier FALSE zurckgeben, da das in CAT.M behandelt wird *)
RETURN FALSE;
END clickInButton;
PROCEDURE kProc (wdw, vdi : INTEGER; env: ADDRESS; taste: INTEGER; key, scan : CHAR; kstate : BITSET): BOOLEAN;
BEGIN
RETURN FALSE
END kProc;
PROCEDURE closeButton (wdw, vdi: INTEGER; env : ADDRESS; force : BOOLEAN): BOOLEAN;
BEGIN
IF ~isHidden & buttonWindowLocked & ~force THEN RETURN FALSE END;
WinHandle := -1;
v.bool := ConfVars.SetConfigBool (cButtonOpen, globalExit);
RETURN TRUE
END closeButton;
PROCEDURE hideButton (wdw, vdi: INTEGER; env : ADDRESS; hide : BOOLEAN);
BEGIN
IF wdw = WinHandle
THEN
isHidden := hide;
END;
END hideButton;
PROCEDURE timerButton (wdw, vdi: INTEGER; env : ADDRESS): BOOLEAN;
BEGIN
IF wdw = WinHandle
THEN
IF wdwTopped THEN wdwTopped := FALSE; WdwManager.WindowIsClosed (wdw); END;
END;
RETURN FALSE;
END timerButton;
PROCEDURE topButton (wdw, vdi: INTEGER; env: ADDRESS): BOOLEAN;
BEGIN
wdwTopped := TRUE;
RETURN TRUE
END topButton;
PROCEDURE untopButton (wdw, vdi: INTEGER; env: ADDRESS);
BEGIN
WdwManager.WindowIsClosed (wdw);
END untopButton;
PROCEDURE setWork (wdw, vdi: INTEGER; env: ADDRESS; doc: GrafBase.LongRect; slided: BOOLEAN);
END setWork;
PROCEDURE getRect (wdw, vdi: INTEGER; env: ADDRESS; VAR r : GrafBase.Rectangle);
BEGIN
WdwManager.GetWdwSize (wdw, UserBLK.buttonW);
v.bool := ConfVars.SetConfigRect (cButton, UserBLK.buttonW);
objPtr^[0].obX := r.x;
objPtr^[0].obY := r.y;
END getRect;
PROCEDURE redrawButton (wdw, vdi : INTEGER; env : ADDRESS; clip : GrafBase.Rectangle);
VAR
path: ARRAY [0..255] OF CHAR;
name: ARRAY [0..15] OF CHAR;
BEGIN
mtDir.SplitPath (MTPaths.lastInfName, path, name, path);
mtUtils.SetObjcString (ButtonWin, MausTauschrsc.catinfna, name);
MagicAES.ObjcDraw (ButtonWin, 0, 8, clip);
END redrawButton;
PROCEDURE updateButton (wdw, vdi: INTEGER; env: ADDRESS; doIt: BOOLEAN);
BEGIN
IF doIt
THEN
MagicAES.WindUpdate (MagicAES.BEGUPDATE);
mtAppl.MouseOff();
ELSE
mtAppl.MouseOn();
MagicAES.WindUpdate (MagicAES.ENDUPDATE);
END;
END updateButton;
PROCEDURE IsButtonTop(handle : INTEGER):BOOLEAN;
BEGIN
RETURN handle = WinHandle
END IsButtonTop;
PROCEDURE setLook (ob: INTEGER);
BEGIN
mtUtils.SetFlag (ButtonWin, ob, MagicAES.Exit, CatGlobal.tos3DLook);
mtUtils.SetFlag (ButtonWin, ob, MagicAES.TOUCHEXIT, ~CatGlobal.tos3DLook);
END setLook;
PROCEDURE DisplayButton(init : BOOLEAN):BOOLEAN;
VAR setName : RECORD CASE :BOOLEAN OF
TRUE : nameAdr, dum : ADDRESS|
FALSE : handle,d1,d2,d3 : INTEGER
END
END;
newY : INTEGER;
BEGIN
IF WinHandle < 0 THEN
IF init THEN
IF ConfVars.GetConfigBool (cButtonOpen, v.bool) & ~v.bool
THEN
RETURN FALSE
END;
END;
WITH UserBLK.buttonW DO
IF (x >= mtAppl.MaxWidth) OR (y >= mtAppl.MaxHeight) THEN y := 0 END;
IF y = 0 THEN
UserBLK.buttonW := WdwManager.deskSize;
newY := y;
ELSE
newY := -1;
END;
MagicAES.WindCalc(MagicAES.WCWORK, elements, UserBLK.buttonW, UserBLK.buttonW);
w := objPtr^[0].obWidth;
h := objPtr^[0].obHeight;
MagicAES.WindCalc(MagicAES.WCBORDER, elements, UserBLK.buttonW, UserBLK.buttonW);
IF newY > 0 THEN y := newY END;
IF WdwManager.OpenWindow (clickInButton, kProc, timerButton,
UserBLK.buttonW, UserBLK.buttonW, elements,
FALSE, '', name, WdwManager.snapProc (NIL),
closeButton, redrawButton, topButton,
untopButton, updateButton, setWork, getRect,
hideButton, 0, NIL,
FALSE, TRUE, TRUE, FALSE, WinHandle, v.int)
THEN
isHidden := FALSE;
(* Buttons an 3D-Look anpassen *)
setLook (MausTauschrsc.readnew);
setLook (MausTauschrsc.readunread);
setLook (MausTauschrsc.readpos);
setLook (MausTauschrsc.readall);
setLook (MausTauschrsc.readdate);
setLook (MausTauschrsc.readnum);
setLook (MausTauschrsc.newmess);
setLook (MausTauschrsc.newpers);
(* Ok, Fenster ist offen *)
v.bool := ConfVars.SetConfigBool (cButtonOpen, TRUE);
WdwManager.GetWdwWork (WinHandle, UserBLK.buttonW);
objPtr^[0].obX := x;
objPtr^[0].obY := y;
WdwManager.GetWdwSize (WinHandle, UserBLK.buttonW);
v.bool := ConfVars.SetConfigRect (cButton, UserBLK.buttonW);
(* Wieder rausnehmen aus WindowQueue *)
WdwManager.WindowIsClosed (WinHandle);
RETURN TRUE
ELSE
v.int := mtAlerts.Alert(1, MTE.NoWin);
v.bool := ConfVars.SetConfigBool (cButtonOpen, FALSE);
RETURN FALSE
END;
END
ELSE
WdwManager.GetTopWindow (setName.handle, v.int);
IF setName.handle = WinHandle THEN
WdwManager.TopNextWindow();
RETURN TRUE
ELSE
WdwManager.TopWindow (WinHandle);
(* Wieder rausnehmen aus WindowQueue *)
WdwManager.WindowIsClosed (WinHandle);
RETURN TRUE
END
END;
END DisplayButton;
PROCEDURE CloseButton(exit: BOOLEAN);
BEGIN
IF WinHandle > 0 THEN
globalExit := exit;
v.bool := WdwManager.CloseWindow (WinHandle, FALSE);
v.bool := ConfVars.SetConfigBool (cButtonOpen, exit);
END;
END CloseButton;
PROCEDURE ClickIsInButton(Wx,Wy : INTEGER):BOOLEAN;
VAR wdw : INTEGER;
BEGIN
IF WinHandle > 0 THEN
WdwManager.ClickInWindow (Wx, Wy, wdw);
IF WinHandle = wdw THEN
RETURN TRUE
ELSE
RETURN FALSE
END
ELSE
RETURN FALSE
END
END ClickIsInButton;
PROCEDURE DrawButton(which : INTEGER);
VAR r : GrafBase.Rectangle;
BEGIN
IF WinHandle >= 0 THEN
mtUtils.CalcArea (ButtonWin, which, r);
WdwManager.RedrawWdw (WinHandle, r);
END;
END DrawButton;
PROCEDURE InitButtonWindow();
BEGIN
ButtonWin := MausTauschrsc.TreeAddr^[MausTauschrsc.desk];
objPtr := ButtonWin;
END InitButtonWindow;
BEGIN
WinHandle := -1;
name := ' Cat ';
globalExit := FALSE;
buttonWindowLocked := FALSE;
isHidden := FALSE;
END CatButtons.